package com.eorchis.module.reply.dao.impl;

import org.springframework.stereotype.Repository;

import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.core.basedao.dao.impl.HibernateAbstractBaseDao;
import com.eorchis.module.reply.dao.IReplyDao;
import com.eorchis.module.reply.domain.Reply;

import com.eorchis.core.basedao.query.condition.builder.CompareType;
import com.eorchis.core.basedao.query.condition.builder.IConditionBuilder;

import com.eorchis.core.ui.commond.IQueryCommond;

import com.eorchis.module.reply.ui.commond.ReplyQueryCommond;

/**
 * Title: ReplyDaoImpl<br>
 * Description: 消息回复表数据接口实现<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author RongSL
 * @createDate 2016-05-06
 * @version $Revision$
 */
@SuppressWarnings("unchecked")
@Repository(value = "com.eorchis.module.reply.dao.impl.ReplyDaoImpl")
public class ReplyDaoImpl extends HibernateAbstractBaseDao implements IReplyDao {
	
	@Override
	public Class<? extends IBaseEntity> entityClass() {
		return Reply.class;
	}

	@Override
	public void queryConditionProcessor(
			IConditionBuilder defaultQueryConditionBuilder,
			IQueryCommond queryCommond) {
		ReplyQueryCommond replyQueryCommond = (ReplyQueryCommond)queryCommond;
		defaultQueryConditionBuilder.setBaseQueryString("SELECT t FROM Reply t");
		defaultQueryConditionBuilder.addCondition("t.replyId", CompareType.IN, replyQueryCommond.getSearchReplyIds());
		defaultQueryConditionBuilder.addCondition("t.replyValue", CompareType.LIKE,replyQueryCommond.getSearchReplyValue());
	}
}
